using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace MoEngine
{
    public class CoreComponent : IUpdateable
    {
        public virtual void Initialize() { }

        #region IUpdateable Members

        protected bool m_bEnabled = true;

        public bool Enabled
        {
            get { return m_bEnabled; }
            set
            {
                if (m_bEnabled != value)
                {
                    m_bEnabled = value;
                    EventHandler tempEvent = EnabledChanged;
                    if (tempEvent != null)
                    {
                        tempEvent(this, null);
                    }
                }

            }
        }

        public event EventHandler EnabledChanged;

        public virtual void Update(GameTime appTime) { }

        protected int m_UpdateOrder = 0;

        public int UpdateOrder
        {
            get { return m_UpdateOrder; }
            set
            {
                if (m_UpdateOrder != value)
                {
                    m_UpdateOrder = value;
                    EventHandler tempEvent = UpdateOrderChanged;
                    if (tempEvent != null)
                    {
                        tempEvent(this, null);
                    }
                }
            }
        }

        public event EventHandler UpdateOrderChanged;

        #endregion
    }
}
